namespace Lzfy_Refund_Service.Models
{
    /// <summary>
    /// 微信消息请求模型
    /// </summary>
    public class WeChatMessageRequest
    {
        /// <summary>
        /// 服务代码
        /// </summary>
        public string ServiceCode { get; set; } = "SendMessageNotice";

        /// <summary>
        /// 合作伙伴ID
        /// </summary>
        public string PartnerId { get; set; } = "lzsfybjy73";

        /// <summary>
        /// 时间戳
        /// </summary>
        public string TimeStamp { get; set; } = string.Empty;

        /// <summary>
        /// 卡号（患者qrCode）
        /// </summary>
        public string CardNo { get; set; } = string.Empty;

        /// <summary>
        /// 住院号
        /// </summary>
        public string AdmissionNum { get; set; } = string.Empty;

        /// <summary>
        /// 住院次数
        /// </summary>
        public string InNo { get; set; } = string.Empty;

        /// <summary>
        /// 消息类型
        /// </summary>
        public string MsgType { get; set; } = "4";

        /// <summary>
        /// 消息内容
        /// </summary>
        public string MsgContext { get; set; } = string.Empty;

        /// <summary>
        /// 个人信息第一行
        /// </summary>
        public string PersonalFirst { get; set; } = string.Empty;

        /// <summary>
        /// 个人信息第二行
        /// </summary>
        public string PersonalSecond { get; set; } = string.Empty;

        /// <summary>
        /// 渠道
        /// </summary>
        public string Channel { get; set; } = "WX";
    }

    /// <summary>
    /// 微信通知结果
    /// </summary>
    public class WeChatNotificationResult
    {
        /// <summary>
        /// 是否成功
        /// </summary>
        public bool Success { get; set; }

        /// <summary>
        /// 消息
        /// </summary>
        public string Message { get; set; } = string.Empty;

        /// <summary>
        /// 生成的XML
        /// </summary>
        public string? GeneratedXml { get; set; }

        /// <summary>
        /// 错误详情
        /// </summary>
        public string? ErrorDetails { get; set; }
    }

    /// <summary>
    /// 微信消息类型枚举
    /// </summary>
    public enum WeChatMessageType
    {
        /// <summary>
        /// 退费申请提交成功
        /// </summary>
        RefundSubmitted = 4,

        /// <summary>
        /// 退费审核通过
        /// </summary>
        RefundApproved = 4,

        /// <summary>
        /// 退费审核拒绝
        /// </summary>
        RefundRejected = 4
    }

    /// <summary>
    /// 企业微信用户信息
    /// </summary>
    public class WeChatUserInfo
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public string UserId { get; set; } = string.Empty;

        /// <summary>
        /// 用户姓名
        /// </summary>
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 部门
        /// </summary>
        public int[] Department { get; set; } = Array.Empty<int>();

        /// <summary>
        /// 职位
        /// </summary>
        public string Position { get; set; } = string.Empty;

        /// <summary>
        /// 手机号
        /// </summary>
        public string Mobile { get; set; } = string.Empty;

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; } = string.Empty;

        /// <summary>
        /// 头像
        /// </summary>
        public string Avatar { get; set; } = string.Empty;
    }

    /// <summary>
    /// 企业微信JS-SDK配置
    /// </summary>
    public class WeChatJsApiConfig
    {
        /// <summary>
        /// 企业ID
        /// </summary>
        public string CorpId { get; set; } = string.Empty;

        /// <summary>
        /// 应用ID
        /// </summary>
        public string AgentId { get; set; } = string.Empty;

        /// <summary>
        /// 时间戳
        /// </summary>
        public long Timestamp { get; set; }

        /// <summary>
        /// 随机字符串
        /// </summary>
        public string NonceStr { get; set; } = string.Empty;

        /// <summary>
        /// 签名
        /// </summary>
        public string Signature { get; set; } = string.Empty;

        /// <summary>
        /// 需要使用的JS接口列表
        /// </summary>
        public List<string> JsApiList { get; set; } = new List<string>();
    }

    /// <summary>
    /// 企业微信Access Token响应
    /// </summary>
    public class WeChatAccessTokenResponse
    {
        /// <summary>
        /// 错误码
        /// </summary>
        public int ErrCode { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrMsg { get; set; } = string.Empty;

        /// <summary>
        /// Access Token
        /// </summary>
        public string AccessToken { get; set; } = string.Empty;

        /// <summary>
        /// 过期时间（秒）
        /// </summary>
        public int ExpiresIn { get; set; }
    }

    /// <summary>
    /// 企业微信获取用户响应
    /// </summary>
    public class WeChatGetUserResponse
    {
        /// <summary>
        /// 错误码
        /// </summary>
        public int ErrCode { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrMsg { get; set; } = string.Empty;

        /// <summary>
        /// 用户ID
        /// </summary>
        public string UserId { get; set; } = string.Empty;

        /// <summary>
        /// 设备ID
        /// </summary>
        public string DeviceId { get; set; } = string.Empty;
    }

    /// <summary>
    /// 企业微信用户详情响应
    /// </summary>
    public class WeChatUserDetailResponse
    {
        /// <summary>
        /// 错误码
        /// </summary>
        public int ErrCode { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrMsg { get; set; } = string.Empty;

        /// <summary>
        /// 用户ID
        /// </summary>
        public string UserId { get; set; } = string.Empty;

        /// <summary>
        /// 用户姓名
        /// </summary>
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 部门
        /// </summary>
        public int[] Department { get; set; } = Array.Empty<int>();

        /// <summary>
        /// 职位
        /// </summary>
        public string Position { get; set; } = string.Empty;

        /// <summary>
        /// 手机号
        /// </summary>
        public string Mobile { get; set; } = string.Empty;

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; } = string.Empty;

        /// <summary>
        /// 头像
        /// </summary>
        public string Avatar { get; set; } = string.Empty;
    }
}